const W = window.innerWidth,
      H = window.innerHeight;
console.log(W,H);

const app = new PIXI.Application({width:W,height:H});
const loader = new PIXI.loaders.Loader();
loader.add('bg1', './imgs/bg.jpg')
      .add('bg2', './imgs/bg_2.jpg')
      .add('boy', './imgs/boy.png')
      .add('eyeOpen', './imgs/eye_open.png');
loader.on("progress", function(target, resource) {  //加载进度
  document.getElementById('percent').innerText = target.progress+"%";
});
loader.once('complete', function(target, resource) {  //加载完成
  document.getElementById('loading').style.display = 'none';
  document.body.appendChild(app.view);
  loadDone();
});
loader.load();
function loadDone(){
  let scene_1 = new PIXI.Container();
  let scene_2 = new PIXI.Container();
  let bg1 = new PIXI.Sprite.fromImage('bg1');
  let bg2 = new PIXI.Sprite.fromImage('bg2');
  let boy = new PIXI.Sprite.fromImage('boy');
  let eyeOpen = new PIXI.Sprite.fromImage('eyeOpen');
  scene_1.addChild(bg1,eyeOpen);
  scene_2.addChild(bg2,boy);
  scene_2.position.x = 1200;
  app.stage.addChild(scene_1,scene_2);
}
let alloyTouch = new AlloyTouch({
  touch:"body",//反馈触摸的dom
  vertical: true,//不必需，默认是true代表监听竖直方向touch
  // target: target, //运动的对象
  property: "translateY",  //被运动的属性
  min: 100, //不必需,运动属性的最小值
  max: 2000, //不必需,滚动属性的最大值
  sensitivity: 1,//不必需,触摸区域的灵敏度，默认值为1，可以为负数
  factor: 1,//不必需,表示触摸位移运动位移与被运动属性映射关系，默认值是1
  moveFactor: 1,//不必需,表示touchmove位移与被运动属性映射关系，默认值是1
  step: 45,//用于校正到step的整数倍
  bindSelf: false,
  maxSpeed: 2, //不必需，触摸反馈的最大速度限制
  initialValue: 0,
  change:function(value){
    console.log(value);
  },
  touchStart:function(evt, value){  },
  touchMove:function(evt, value){  },
  touchEnd:function(evt,value){  },
  tap:function(evt, value){  },
  pressMove:function(evt, value){  },
  animationEnd:function(value){  } //运动结束
})
